<cfcomponent extends="base">

<cffunction name="GET" returntype="any" access="public">

<cfinvoke component="data" method="expertise" returnvariable="expertise">
<cfinvoke component="data" method="companys" returnvariable="companys">
	
<cfinvoke component="data" method="category" returnvariable="inst">
<cfinvoke component="data" method="five_star_area_category" returnvariable="area">



<cftry>
<cfif isdefined("url.id")>
<cfinvoke component="data" method="get_poc_detail" returnvariable="get_saa" id="#url.id#" >

<div id="email_pane"><input type="button" value="Send Email" id="send_email" class="button" 
onclick="javascript:window.open('/email.cfm?type=poc&id=<cfoutput>#get_saa.poc_id#</cfoutput>','Email','')"></div>

<table border='0' name="main" width="98%" cellspacing="0" cellpadding="0">
<tr><td >

<div class="practitioner_edit" id=""> 

<form name='myform' action='' method='post' id="myform"  enctype="multipart/form-data">
<input type="hidden" name="pid" value="<cfoutput>#url.id#</cfoutput>">

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">POC Type:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="get_poc_type" returnvariable="poc_type">
<select name='poc_type'  ><cfloop from="1" to="#poc_type.recordcount#" index="i"><cfoutput><option class="" id="" value="#poc_type.poc_type[i]#" <cfif get_saa.poc_type eq poc_type.poc_type[i]>selected</cfif>>#poc_type.poc_type[i]#</option></cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Government Type:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="get_gov_type" returnvariable="get_gov_type">
<select name='gov_type'  ><cfloop from="1" to="#get_gov_type.recordcount#" index="i"><cfoutput><option class="" id="" value="#get_gov_type.gov_type[i]#" <cfif get_saa.gov_type eq get_gov_type.gov_type[i]>selected</cfif>>#get_gov_type.gov_type[i]#</option></cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Discipline Type:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="get_discipline" returnvariable="get_discipline">
<select name='discipline'  ><cfloop from="1" to="#get_discipline.recordcount#" index="i"><cfoutput><option class="" id="" value="#get_discipline.discipline[i]#" <cfif get_saa.discipline eq get_discipline.discipline[i]>selected</cfif>>#get_discipline.discipline[i]#</option></cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Prefix:</span>
<span class="Form_Item_Field"><select name='title' class=''><option value='Mr.'>Mr.</option><option value='Ms.'>Ms.</option></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">First Name:</span>
<span class="Form_Item_Field"><input type='text' name='first_name' class='' value="<cfoutput>#get_saa.first_name#</cfoutput>" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Last Name:</span>
<span class="Form_Item_Field"><input type='text' name='last_name' class=''  value="<cfoutput>#get_saa.last_name#</cfoutput>" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Job Title:</span>
<span class="Form_Item_Field"><input type='text' name='job_title' class=''  value="<cfoutput>#get_saa.job_title#</cfoutput>" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Company:</span>
<span class="Form_Item_Field"><input type="text" id="company_freeform" name="company_freeform" class="" value="<cfoutput>#get_saa.company#</cfoutput>">&nbsp;or&nbsp;<select class="" id="" name="company">
<cfloop from="1" to="#companys.recordcount#" index="i">
<cfoutput><option class="" id="" value="#companys.company[i]#" <cfif get_saa.company eq companys.company[i]>selected</cfif>>#companys.company[i]#</option>
</cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Address:</span>
<span class="Form_Item_Field"><textarea name='address' class=''  cols="30" rows="6"><cfoutput>#get_saa.address#</cfoutput></textarea></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">City:</span>
<span class="Form_Item_Field"><input type='text' name='city' class=''  value="<cfoutput>#get_saa.city#</cfoutput>" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">State:</span>
<span class="Form_Item_Field"><cfinvoke component="data" method="states" returnvariable="states">
	<select name='state'  ><cfloop from="1" to="#states.recordcount#" index="i"><cfoutput><option class="" id="" value="#states.state_id[i]#" <cfif get_saa.state eq states.state_id[i]>selected</cfif>>#states.state[i]# - #states.state_id[i]#</option></cfoutput></cfloop></select></span>
</div>


<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Zip Code:</span>
<span class="Form_Item_Field"><input type='text' name='zip'id='zip' class=''  value="<cfoutput>#get_saa.zip#</cfoutput>" /><span class="Form_Item_Error" id="error_zip"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Phone:</span>
<span class="Form_Item_Field"><input type='text' name='phone' id='phone' class='' value="<cfoutput>#get_saa.phone#</cfoutput>"  /><span class="Form_Item_Error" id="error_phone"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Alt Phone:</span>
<span class="Form_Item_Field"><input type='text' name='alt_phone' id='alt_phone' class=''  value="<cfoutput>#get_saa.alt_phone#</cfoutput>" /><span class="Form_Item_Error" id="error_alt_phone"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Email:</span>
<span class="Form_Item_Field"><input type='text' name='email'id='email' class=''  value="<cfoutput>#get_saa.email#</cfoutput>" /><span class="Form_Item_Error" id="error_email"></span></span>
</div>

<div class="Content_Margin_Form_Line"><cfinvoke component="data" method="get_5_star_area" returnvariable="get_5_star_area" >
<span class="Form_Item_Label">5 Star Area:</span>
<span class="Form_Item_Field">
<div id="fsa" style="display:inline;"> </div><span id="loading"> </span>
</span></div>

<DIV CLASS="display_area">
<TABLE><TBODY><TR><TD WIDTH="110px"> </TD>
<TD>

<table id="area_table">
<cfloop from="1" to="#get_5_star_area.recordcount#" index="i">
<tr>
<td align="right" width="1%"><cfoutput>#get_5_star_area.area[i]#</cfoutput>:</td>
<td align="left" id="parent_area_<cfoutput>#get_5_star_area.five_star_area_category_id[i]#</cfoutput>" class="sub_area"></td>
</tr>
</cfloop>
</table>

<input type="hidden" id="sub_area_list" name="sub_area_list" value="<cfoutput>#get_saa.five_star_category#</cfoutput>" />
<input type="hidden" id="sid_list"name="sid_list" value="<cfoutput>#session.queries.make_IDList(get_saa.five_star_category)#</cfoutput>" />

</TD></TR></TBODY></TABLE>
</DIV>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Yrs. 5 Star Area Experience:</span>
<span class="Form_Item_Field"><input type='text' name='yrs_five_star_area_experience'id='yrs_five_star_area_experience' class='' size='4' value="<cfoutput>#get_saa.yrs_five_star_area_experience#</cfoutput>" />&nbsp;Years <span class="Form_Item_Error" id="error_yrs_five_star_area_experience"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Yrs. Category Experience:</span>
<span class="Form_Item_Field"><input type='text' name='yrs_category_experience'id='yrs_category_experience' class='' size='4'  value="<cfoutput>#get_saa.yrs_category_experience#</cfoutput>" />&nbsp;Years <span class="Form_Item_Error" id="error_yrs_category_experience"></span></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Overall Level of Expertise:</span>
<span class="Form_Item_Field"><select class="" id="" name="level_expertise"><cfloop from="1" to="#expertise.recordcount#" index="i">
<cfoutput><option class="" id="" value="#expertise.expertise[i]#">#expertise.expertise[i]#</option>
</cfoutput></cfloop></select></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Certification:</span>
<span class="Form_Item_Field"><input type='text' name='certification' id='certification' class=''  value="<cfoutput>#get_saa.certification#</cfoutput>" /></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Availability Start:</span>
<span class="Form_Item_Field"><input type="text" value="<cfoutput>#dateformat(get_saa.availability_start,"mm/dd/yyyy")#</cfoutput>" id='tf_start' name='tf_start'  >
</span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Availability End:</span>
<span class="Form_Item_Field">
<input type="text" value="<cfoutput>#dateformat(get_saa.availability_end,"mm/dd/yyyy")#</cfoutput>" id='tf_end' name='tf_end'  >
</span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Comments:</span>
<span class="Form_Item_Field"><textarea name="comments" cols="60" rows="10"><cfoutput>#get_saa.comments#</cfoutput></textarea></span>
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Add Resume':</span>
<span class="Form_Item_Field"><input type="file" name="uploadfile" size="30"></span></div>

<cfinvoke component="data" method="get_resumes" returnvariable="get_resumes" id="#get_saa.poc_id#"> 

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label">Documents:</span>
<span class="Form_Item_Field"><div id="search_results_area" style="display:inline; padding:0px;"></div></span>
<input type="hidden" id="id" name="id" value=""><input type="hidden" id="ajax_poc_id" name="ajax_poc_id" value=""><input type="hidden" id="action" name="action" value=""><input type="hidden" id="poc_id" name="poc_id" value="<cfoutput>#get_saa.poc_id#</cfoutput>">
</div>

<div class="Content_Margin_Form_Line">
<span class="Form_Item_Label"></span>
<span class="Form_Item_Field"><input type='submit' class="button" name="Save" value="Save Changes to Point of Contact" id="save"/><span id="edit_loading" class="loading"></span>&nbsp;<span class="Form_Item_Error" id="error_save"></span><input type='hidden' name='script' value='poc_detail'></span>
</div>
</div>
</form>


</td>


</tr>
</table>

</cfif>
<cfcatch>

</cfcatch>
</cftry>
</cffunction>



	
<cffunction access="public" name="POST">

<cfset list_parent = session.queries.make_pList(form.sub_area_list)>
<cfquery name="update_detail" datasource="#Session.dsn#">
Update poc_detail
Set 
first_name = '#form.first_name#', 
last_name = '#form.last_name#', 
address = '#form.address#', 
city = '#form.city#', 
state = '#form.state#', 
zip = '#form.zip#', 
phone = '#form.phone#', 
alt_phone = '#form.alt_phone#',
email =  '#form.email#',
title = '#form.title#',
job_title = '#form.job_title#',
poc_type = '#form.poc_type#',
gov_type = '#form.gov_type#',
discipline = '#form.discipline#',
yrs_category_experience = '#form.yrs_category_experience#',
yrs_five_star_area_experience = '#form.yrs_five_star_area_experience#',
<cfif form.tf_start neq "">availability_start = '#dateformat(form.tf_start,"mm/dd/yyyy")#',<cfelse>availability_start = '#dateformat("01-01-1900","mm/dd/yyyy")#',</cfif>
<cfif form.tf_end neq "">availability_end = '#dateformat(form.tf_end,"mm/dd/yyyy")#',<cfelse>availability_end = '#dateformat("01-01-3000","mm/dd/yyyy")#',</cfif>
five_star_area = '#list_parent#',
five_star_category = '#form.sub_area_list#',
company = <cfif form.company_freeform neq "" or form.company eq "not_selected">'#form.company_freeform#'<cfelse>'#form.company#'</cfif>,
comments = '#form.comments#',
certification = '#form.certification#'
WHERE poc_id = #url.id#
</cfquery>

<cftry>



<cfif form.uploadfile neq "">
<cffile action="upload" fileField="form.uploadfile" destination="#Session.file_path#repository\" nameconflict="makeunique" result="file_name">
<cfquery name="insert_detail2" datasource="#Session.dsn#">
insert into resume_directory(poc_id, resume_location, resume_title)
values( #url.id#,'/repository/#file_name.clientFile#', '#file_name.serverFileName#.#file_name.ClientFileExt#');

</cfquery>
</cfif>


<cflocation url="/edit.cfm?id=#url.id#" addtoken="no">


<cfcatch type="any">
A error occured duing upload process!  <a href="<cfoutput>#cgi.HTTP_REFERER#</cfoutput>">Go back!</a>
</cfcatch>

 </cftry>
</cffunction>

	
</cfcomponent>